package com.lvmama.rhino.service.impl;

import com.lvmama.rhino.mapperDw.RepurchaseMapper;
import com.lvmama.rhino.pojo.RepruchaseAnalysis;
import com.lvmama.rhino.pojo.RepruchaseAnalysisQuery;
import com.lvmama.rhino.service.RepurchaseService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RepurchaseServiceImpl implements RepurchaseService {
	private Logger log = Logger.getLogger(RepurchaseServiceImpl.class);
	@Autowired
	private RepurchaseMapper repurchaseMapper;

	@Override
	public List<RepruchaseAnalysis> queryRepruchaseAnalysisList(RepruchaseAnalysisQuery query) {
		log.info("queryRepruchaseAnalysisList start, query:" + query);
		List<RepruchaseAnalysis> repruchaseAnalysisList = null;

		try {
			repruchaseAnalysisList = repurchaseMapper.queryRepruchaseAnalysisList(query);
		} catch (Exception e) {
			log.error("queryRepruchaseAnalysisList error:" + e.getMessage());
		}
		log.info("queryRepruchaseAnalysisList end.");
		return repruchaseAnalysisList;
	}

	@Override
	public RepruchaseAnalysis selectLatestRecord() {
		log.info("selectLatestRecord start.");
		RepruchaseAnalysis repruchaseAnalysis = null;
		try {
			repruchaseAnalysis = repurchaseMapper.selectLatestRecord();
		} catch (Exception e) {
			log.error("selectLatestRecord error:" + e.getMessage());
		}
		log.info("selectLatestRecord end.");
		return repruchaseAnalysis;
	}
}
